__version__ = "{{ version }}"

try:
  from baml_py.safe_import import EnsureBamlPyImport
except ImportError:
  raise ImportError(f"""Update to baml-py required.
Version of baml_client generator (see generators.baml): {__version__}

Please upgrade baml-py to version "{__version__}".

$ pip install baml-py=={__version__}
$ uv add baml-py=={__version__}

If nothing else works, please ask for help:

https://github.com/boundaryml/baml/issues
https://boundaryml.com/discord
""") from None


with EnsureBamlPyImport(__version__) as e:
  e.raise_if_incompatible_version(__version__)

  from . import types
  from . import tracing
  from . import stream_types
  from . import config
  from .config import reset_baml_env_vars
  {% if default_client_mode == GeneratorDefaultClientMode::Async %}
  from .async_client import b
  {% else %}
  from .sync_client import b
  {% endif %}
  from . import watchers


# FOR LEGACY COMPATIBILITY, expose "partial_types" as an alias for "stream_types"
# WE RECOMMEND USERS TO USE "stream_types" INSTEAD
partial_types = stream_types

__all__ = [
  "b",
  "stream_types",
  "partial_types",
  "tracing",
  "types",
  "reset_baml_env_vars",
  "config",
  "watchers",
]
